<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>添加意见 - Powered By Betou</title>
<meta name="author" content="Betou Team" />
<meta name="copyright" content="Betou" />
<#include "../head.html"/>
<script type="text/javascript">var _BASE="${base}/";</script>
<link href="${base}/thirdparty/swfupload2_5/swf.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${base}/thirdparty/swfupload2_5/swfupload.js" charset="utf-8"></script>
<script type="text/javascript" src="${base}/thirdparty/swfupload2_5/fileprogress.js" charset="utf-8"></script>
<script type="text/javascript" src="${base}/thirdparty/swfupload2_5/handlers_logo.js" charset="utf-8"></script>
<script type="text/javascript">
$().ready(function() {

	var $inputForm = $("#inputForm");
	
	// 表单验证
	$inputForm.validate({
		rules: {
			typeId: "required",
			email: { required: true, email:true, maxlength:100 },
			mobile: { required: true, digits:true, minlength:11 },
			title: "required",
			content:{ required:true,	minlength:6, maxlength:1000	}
		},
	});

});
function addImage(p, src, id) {
	var inputForm = $('#inputForm');
	var hiddenInput = document.createElement('input');
	hiddenInput.type='hidden';
	hiddenInput.name="filepath";
	hiddenInput.value=src;
	inputForm.append( hiddenInput );
	
	if(src.indexOf(".")>-1){
		var suffix = src.substring(src.lastIndexOf(".")+1);
		suffix = suffix.toLowerCase();
		if("jpg;png;gif;jpeg".indexOf(suffix)>-1){
			var img = new Image();
			img.src= _BASE + src;
			
			var a = document.createElement("a");
			a.href = _BASE+src;
			a.title="查看大图";
			a.target="_blank";
			a.appendChild(img);
			
			$( p.fileProgressElement.childNodes[4] ).append(a).css("background",'none');
		}
	}
}
</script>
</head>
<body class="content">
	<div class="path">
		<a href="../index.jspx">首页</a> &raquo;  添加意见
	</div>
	<form id="inputForm" action="o_save.jspx" method="post"  >
		<table class="input tabContent">
			<tr>
				<th><span class="requiredField">*</span>类型:</th>
				<td>
					<select name="typeId">
					<#if suggestionType??>
						<option value="">(请选择一个类型)</option>
					<#list suggestionType as item>
						<option value="${item.typeId}" >${item.name}</option>
					</#list>
					</#if>
					</select>
				</td>
			</tr>
			<tr>
				<th><span class="requiredField">*</span>邮箱:</th>
				<td>
					<input type="text" name="email" class="text" maxlength="50" style="width:350px" value="${admin.email!}"/>
				</td>
			</tr>
			<tr>
				<th><span class="requiredField">*</span>手机:</th>
				<td>
					<input type="text" name="mobile" class="text" maxlength="50" style="width:350px" value="${admin.mobile!}"/>
				</td>
			</tr>
			<tr>
				<th><span class="requiredField">*</span>标题:</th>
				<td>
					<input type="text" name="title" class="text" maxlength="100" style="width:350px"/>
				</td>
			</tr>
			<tr>
				<th><span class="requiredField">*</span>内容:</th>
				<td>
					<textarea class="text" name="content" title="内容最多1000字" ></textarea>
				</td>
			</tr>
			<tr>
				<th>附件上传：<br/>(最多3个)&nbsp;&nbsp;</th>
				<td>
					<div class="fieldset flash" id="fsUploadProgress" style="display: inherit">
						<span id="uplimit" class="legend"></span>
					</div>
					<div>
					<input type="button" id="uploadBtn" value="选择文件" style="display: inherit"/>
					</div>
				</td>
			</tr>
			<tr>
				<th>
					&nbsp;
				</th>
				<td>
					<input type="submit" class="button" value="确&nbsp;&nbsp;定" />
					<input type="button" class="button" value="返&nbsp;&nbsp;回" onclick="location.href='v_list.jspx'" />
				</td>
			</tr>
		</table>
	</form>
	<#include "../footer.html"/>
</body>
</html>
<script type='text/javascript'>
var swfu;
var jsessionid = getCookie("JSESSIONID");
var uploadUrl='/all_upload.jhtml';
if(jsessionid) {
	uploadUrl += ";jsessionid="+jsessionid;
}

var settings = {
	post_params: {"directory": "upload/sugg"},
	flash_url:"${base}/thirdparty/swfupload2_5/swfupload.swf", 
	flash9_url:"${base}/thirdparty/swfupload2_5/swfupload_fp9.swf", 
	upload_url: uploadUrl,  
	file_size_limit:"10MB", 
	file_types:"*.txt;*.doc;*.docx;*.xls;*.xlsx;*.jpg;*.png;*.gif;*.jpeg;*.zip;*.rar", 
	file_types_description:"文本,WORD,图片,压缩包", 
	file_upload_limit:3, 
	file_queue_limit:3, 
	custom_settings:{progressTarget:"fsUploadProgress", cancelButtonId:"btnCancel"}, 
	button_image_url:"${base}/thirdparty/swfupload2_5/choose_file.jpg", 
	button_placeholder_id:"uploadBtn", 
	button_width:175, 
	button_height:52, 
	button_text_top_padding:0, 
	button_window_mode:SWFUpload.WINDOW_MODE.TRANSPARENT, 
	button_cursor:SWFUpload.CURSOR.HAND, 
	swfupload_preload_handler:preLoad, 
	swfupload_load_failed_handler:loadFailed, 
	file_queued_handler:fileQueued, 
	file_queue_error_handler:fileQueueError, 
	upload_start_handler:uploadStart, 
	upload_progress_handler:uploadProgress, 
	upload_error_handler:uploadError, 
	upload_success_handler:uploadSuccess, 
	upload_complete_handler:uploadComplete
};

swfu = new SWFUpload(settings);
$(document).ready(function(){
	if( !swfu.support.loading ){
		$('#fsUploadProgress').html('您当前的Flash Player版本过低,无法支持头像上传,点击<a href="http://get.adobe.com/cn/flashplayer/otherversions/" target="_blank">下载</a>');
	}
})
</script>